package pl.ydp.components.mathcell.mathrecognizer.engine.database.modelsets.math_basic.characters
{
	import pl.ydp.components.mathcell.mathrecognizer.characters.Character;
	import pl.ydp.components.mathcell.mathrecognizer.geometry.classification.PrimitiveType;
	import pl.ydp.components.mathcell.mathrecognizer.model.PrimitivesRelation;
	import pl.ydp.components.mathcell.mathrecognizer.model.RelationDescription;
	import pl.ydp.components.mathcell.mathrecognizer.model.RelationDescriptorType;
	import pl.ydp.components.mathcell.mathrecognizer.model.ShapeModel;
	import pl.ydp.components.mathcell.mathrecognizer.model.descriptors.ConnectionsDescriptor;
	import pl.ydp.components.mathcell.mathrecognizer.model.descriptors.LocationDescriptor;
	import pl.ydp.components.mathcell.mathrecognizer.model.descriptors.ObjectDescriptor;
	import pl.ydp.components.mathcell.mathrecognizer.model.descriptors.SizeDescriptor;
	import pl.ydp.components.mathcell.mathrecognizer.model.presets.PrimitivePresets;
	
	public class MB_ch_goe
	{
		public static const MODELS_COUNT:Number = 1;
		
		//---------------------------------------------------
		
		public static function getModels():Array{
			
			var goeShapeModels:Array = new Array();
			
			goeShapeModels.push(getModel0());	
			goeShapeModels.push(getModel1());		
			
			return goeShapeModels;
		}
		
		//---------------------------------------------------
		
		private static function getModel0():ShapeModel{
			var goe:ShapeModel;
			var name:String = "MB_≥_DWN";
			var goe_prim:Array = new Array();
			var goe_ref:Array = new Array();
			var goe_rel:Array = new Array();
			
			goe_prim.push(PrimitiveType.LINE1, PrimitiveType.LINE3 | PrimitiveType.LINE0, PrimitiveType.LINE0 | PrimitiveType.LINE3);
			
			goe_ref.push(0,1,2,PrimitivePresets.RLT_FULL);
			
			
			goe_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST, 10, 
				ObjectDescriptor.END_SOUTHERN, ObjectDescriptor.END_NORTHERN)));
			
			goe_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 10,
				ObjectDescriptor.HALF_BOTTOM, ObjectDescriptor.MAX_TOP)));
			
			goe_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 10)));
			
			goe_rel.push(new RelationDescription(2,3,new PrimitivesRelation(RelationDescriptorType.SIZE, SizeDescriptor.IS_WIDER_THAN_HALF, 10)));
			
			goe = new ShapeModel(Character.GREATER_OR_EQUALS, goe_prim, goe_ref, goe_rel, new Array(), name, false, true);
			
			return goe;						
		}		
		//---------------------------------------------------
		
		private static function getModel1():ShapeModel{
			var goe:ShapeModel;
			var name:String = "MB_≥_UP";
			var goe_prim:Array = new Array();
			var goe_ref:Array = new Array();
			var goe_rel:Array = new Array();
			
			goe_prim.push(PrimitiveType.LINE0, PrimitiveType.LINE3, PrimitiveType.LINE3);
			
			goe_ref.push(0,1,2,PrimitivePresets.RLT_FULL);
			
			
			goe_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST, 10, 
				ObjectDescriptor.END_SOUTHERN, ObjectDescriptor.END_NORTHERN)));
			
			goe_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 10,
				ObjectDescriptor.HALF_BOTTOM, ObjectDescriptor.MAX_TOP)));
			
			goe_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 10)));
			
			goe_rel.push(new RelationDescription(2,3,new PrimitivesRelation(RelationDescriptorType.SIZE, SizeDescriptor.IS_WIDER_THAN_HALF, 10)));
			
			goe = new ShapeModel(Character.GREATER_OR_EQUALS, goe_prim, goe_ref, goe_rel, new Array(), name, false, true);
			
			return goe;						
		}		
		//---------------------------------------------------
	}
}